<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
}  
session_start();

if(!isset($_SESSION['db'])){
	$addressbrowser = $_SERVER['SERVER_NAME'];
	$temp = explode(".", $addressbrowser);
	$connection = mysql_connect("1.234.53.52", "cam", "5678" ) ;
	//$connection = mysql_connect("localhost", "root", "root" ) ;
	mysql_select_db("elihan", $connection);
	mysql_query("set names 'utf8'");
	$selectdatabase = mysql_query("SELECT am.DatabaseName,am.Logo from ac_eli_manager am where am.KeyName='$temp[0]' and am.`Status` = 2");
	$result = mysql_fetch_assoc($selectdatabase);

	$_SESSION['Logo']=$result[Logo];
	$_SESSION['db']= $result[DatabaseName];
}
$database = $_SESSION['db'];
$connectadmin = mysql_connect("1.234.53.52", "cam", "5678") or die("Không kết nối được database");
//$connectadmin = mysql_connect("localhost", "root", "root") or die("Không kết nối được database");
mysql_select_db("elihan", $connectadmin);
mysql_query("set names 'utf8'");

$sql="SELECT eli.PartnerName,eli.Email,eli.Phone,eli.Website,eli.Logo, eli.Address,eli.BusinessNumber, eli.CorporateNumber, eli.Content FROM ac_eli_manager eli where eli.DatabaseName='$database'";
$selectprofilecomp = mysql_query($sql);

$row = mysql_fetch_assoc($selectprofilecomp);
$compname = $row['PartnerName'];
$corpnumber = $row['CorporateNumber'];
$bussnumber = $row['BusinessNumber'];
$address = $row['Address'];
$phone = $row['Phone'];
$email = $row['Email'];
$website = $row['Website'];
$logo = $row['Logo'];
$content = $row["Content"];


?>
<script type="text/javascript">
function checkvalidate(){
	var compname = document.getElementById("compname").value;
	if(compname.length==0){
		alert('<?=$l_alertcompanynameinfo?>');
		return false;
	}
}
function updateProfileCompany(els){
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		    //alert(xmlhttp.responseText);
	        document.getElementById("contentprocomp").innerHTML=xmlhttp.responseText;
	    }
	  }
	var lang = '<?=$_SESSION['lang']?>';
	xmlhttp.open("GET","admin/companyprofile/process-update-profile-company.php?newlang="+lang,true);
	xmlhttp.send();
}

</script>
<script type="text/javascript">
$(document).ready(function(){
<?php 
if (isset($_SESSION['alert'])){?>
	alert("<?=$l_capnhatthanhcong?>");
<?php unset($_SESSION['alert']);}
?>
});
</script>
<style>
<!--
.tbInfo-header {
border-bottom: #e2d5f3 solid 1px;
border-top: #e2d5f3 solid 1px;
padding: 5px 10px;
background: #f0e9f9;
font-size: 14px;
font-weight: bold;
color: #782db6;
position: relative;
}
.tbInfo-row {
padding: 7px 20px;
line-height: 23px;
border-bottom: #ddd dotted 1px;
border-right: #ddd dotted 1px;
}
* {
margin: 0;

font-size: 12px;
}
-->
</style>
<div id="contains" style="background-color: #edf4f7;">

	<div class="title" style="padding-top: 5px;font-weight: bold;"><?=$l_menu_companyprofile?></div>
	<div class="body" id="contentprocomp">
		<div style="height: 10px;"></div>
		<div style="border-radius: 7px 7px 0px 0px;width: 99%;border: 1px solid silver;margin: 0px 0px 10px 5px;">
			<span style="display: block;background: #216CA3;color: white;margin-top: 10px;padding: 5px 0 5px 0px;text-align: center;font-weight: bold;"> <?php echo $l_compprofile?></span> <br />
			<div id="content">
					<table width="100%" cellpadding="0" cellspacing="0" border="0" style="background: white">
						<tr>
							<td class="tbInfo-row" style="width: 150px"><?php echo $l_company_name?></td>
							<td class="tbInfo-row"><?php echo $compname;?></td>
						</tr>
						<tr>
							<td class="tbInfo-row"><?php echo $l_corponum?></td>
							<td class="tbInfo-row"><?php echo $corpnumber;?></td>
						</tr>
						<tr>
							<td class="tbInfo-row"><?php echo $l_bussinum?></td>
							<td class="tbInfo-row"><?php echo $bussnumber;?></td>
						</tr>
						<tr>
							<td class="tbInfo-row"><?php echo $l_address?></td>
							<td class="tbInfo-row"><?php echo $address;?></td>
						</tr>
						<tr>
							<td class="tbInfo-row"><?php echo $l_phone?></td>
							<td class="tbInfo-row"><?php echo $phone;?></td>
						</tr>
						<tr>
							<td class="tbInfo-row"><?php echo $l_email?></td>
							<td class="tbInfo-row"><?php echo $email;?></td>
						</tr>
						<tr>
							<td class="tbInfo-row"><?php echo $l_Website?></td>
							<td class="tbInfo-row"><?php echo $website;?></td>
						</tr>
						<tr>
							<td class="tbInfo-row"><?php echo $l_company_info?></td>
							<td class="tbInfo-row"><textarea id="content" name="content"  readonly="readonly"
								style="height: 100px;border: none;font-size: 12px;" ><?php echo $content;?></textarea></td>
						</tr>
					</table>
				<div style="height: 20px;"></div>
			</div>
		</div>
		<div style="height: 20px;"></div>
		
	</div>
</div>
<?php mysql_close($connectadmin);?>